package cn.tedu.review;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

/**
 * @author ：Dsi
 * @date ：2021/11/18 18:56
 * Describe ：该类用于复习Map及hashMap集合
 */
public class Test01 {
    public static void main(String[] args) {
        HashMap<Integer,String> h=new HashMap<>();
        h.put(123,"黑");
        h.put(124,"白");
        h.put(125,"红");
        h.put(126,"橙");
        h.put(127,"黄");
        h.put(128, "绿");
        Set<Map.Entry<Integer, String>> set = h.entrySet();
        Iterator<Map.Entry<Integer, String>> i = set.iterator();
        while (i.hasNext()){
            System.out.println(i.next());
        }
        System.out.println("=------===------=");
        Set<Integer> i1 = h.keySet();
        for (Integer a:i1
             ) {
            System.out.print(a+"=");
            System.out.println(h.get(a));
        }
    }
}
